package com.hissy.common.design.action.medium;

/**
 * Created by zhangyanfei on 2019/4/11.
 *
 * @author zhangyanfei
 * @date 2019/04/11
 */
public class MediatorMain {

    public static void main(String[] args) {

        AbstractColleague colleagueA = new ColleagueA();
        AbstractColleague colleagueB = new ColleagueB();
        /**
         * 通过一个中介者来 处理同事对象的相互影响
         */
        Mediator mediator = new Mediator(colleagueA, colleagueB);

        colleagueA.setNumber(100, mediator);

        System.out.println(colleagueA.getNum() + "------" + colleagueB.getNum());

        colleagueB.setNumber(100, mediator);

        System.out.println(colleagueA.getNum() + "------" + colleagueB.getNum());

    }
}
